Skip to content

feat: LEGGOS area magnification on LensCalc (arc phase 6a) - #685

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/area-magnification-lenscalc
Oct 30, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/area-magnification-lenscalc

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Arc phase 6a (epic cluster-strong-lensing): the LEGGOS II (arXiv:2606.20804) Eq. 6-7 area magnification on LensCalc, the standard arc magnification in cluster lensing. Sum the image-plane area of a mask and invert the local Hessian magnification per sub-pixel to get the source-plane area; their ratio is the area magnification, and the source-plane area links to the physical size of the source. Needs only the magnification map — no source model, no forward ray-shooting (the ShapeSolver stays out of scope). A PyAutoLens Tracer reaches it through LensCalc.from_tracer (multi-plane via plane_j).

Design decisions (flagged for review):

  • Magnification evaluated at the centres of sub_size x sub_size sub-pixels (default 4) rather than LEGGOS's one value per pixel; convergence is second order in the sub-pixel size (measured 3.9e-4 → 5.7e-6 for sub_size 1 → 8 on a 0.1″ mask).
  • A mask spanning several images of one source double-counts the source area, so area_magnification_from is documented as one-image, and image_masks_from / area_magnification_list_from split a mask into images by parity (sign of μ, the critical curve being the boundary) + connected regions. Same-parity images that touch are not separated (documented).
  • NumPy only for now (scipy.ndimage.label for the split).

Heart at ship: STALE — "release validation stale: source moved since rehearsal (PyAutoFit, PyAutoArray, PyAutoGalaxy, PyAutoLens)"; human authorized shipping ("keep going with 6a, ship it when tests pass", 2026-10-30).

API Changes

Four new LensCalc methods for area magnification over an image-plane mask; nothing existing changes.
See full details below.

Test Plan

  • New test_autogalaxy/operate/test_area_magnification.py: analytic SIS annulus μ_area (measured −4.7e-4) and source-plane area (−1.5e-4); sub_size convergence monotone, second order; parity split of an annulus straddling the Einstein ring into the two rings with the outer one matching the analytic value (−6e-4); whole-mask double-counting trap.
  • PyAutoGalaxy full suite: 1466 passed
  • PyAutoLens full suite against the branch: 1015 passed, 1 xfailed
  • black clean on the new code (pre-existing formatting in lens_calc.py left untouched)
Full API Changes (for automation & release notes)

Added

  • LensCalc.source_plane_area_from(mask, sub_size=4) -> float — A_src = Σ A_pix,i / |μ_i| (LEGGOS Eq. 7)
  • LensCalc.area_magnification_from(mask, sub_size=4) -> float — μ_area = A_img / A_src for a mask covering one image (Eq. 6)
  • LensCalc.image_masks_from(mask) -> List[Mask2D] — split a mask into lensed images (same-parity connected regions), largest first
  • LensCalc.area_magnification_list_from(mask, sub_size=4) -> List[float] — one area magnification per image

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

Area magnification of an image-plane region (LEGGOS II, arXiv:2606.20804, Eq. 6-7):
mu_area = A_img / A_src with A_src = sum_i A_pix,i / |mu_i|, the Hessian
magnification evaluated at sub-pixel centres.

- `LensCalc.source_plane_area_from(mask, sub_size=4)` (links to source size)
- `LensCalc.area_magnification_from(mask, sub_size=4)` for a mask covering one image
- `LensCalc.image_masks_from(mask)` splits a mask into images (same-parity connected regions)
- `LensCalc.area_magnification_list_from(mask, sub_size=4)` one value per image

Tests: analytic SIS annulus (mu and A_src), sub_size convergence, parity split across
the Einstein ring, the multi-image double-counting trap.

Closes #684

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Oct 30, 2026
@Jammy2211
Jammy2211 merged commit 89f408a into main Oct 30, 2026
4 checks passed
@Jammy2211
Jammy2211 deleted the feature/area-magnification-lenscalc branch October 30, 2026 12:28
@pyautolabs-bot pyautolabs-bot Bot removed the pending-release PR queued for the next release build label Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant